<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Album</title>
	<link rel="shortcut icon" href="images/doremon_smile_icon.png" />
	<link rel="stylesheet" type="text/css" href="css/style.css"/>
	<link rel="stylesheet" type="text/css" href="css/explorer.css"/>
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/upload.js"></script>
	<script type="text/javascript" src="js/login.js"></script>
	<script type="text/javascript" src="js/speedtest.js"></script>
</head>
<body>
<?php require_once '_header.php'; ?>
<div id="page">
<?php
if (isset($_SESSION['id'])) {
	$members_id = $_SESSION['id'];
    $query = "SELECT id, name, url, upload_date
              FROM images
              WHERE members_id = $members_id";
	require_once 'model/database.php';
	$connect = connectDB();
    $result = mysqli_query($connect, $query) or die(mysqli_error($connect));
    $number = mysqli_num_rows($result);
    echo "<h3>you have $number images</h3>\n";
    $i = 0;
    echo "<div id='gallery'>\n";
    while($rows = mysqli_fetch_array($result)) {
    	$url = $rows['url'];
    	echo "<a href='$url'><img height='150' width='230' src='$url'/></a>\n";
    	// if (++$i % 4 == 0) echo "</div>\n<div>\n";
    }
    echo "</div>\n";
    mysql_free_result($result);
echo "
	<div id='upload'>
        <div>
            <input type='file' name='images' id='images' multiple />
            <button id='btn'>Upload Files!</button>
        </div>

        <div id='response'>. . .</div>
    </div>
";
}else{
	echo "<h3>you must login!</h3>";
}
?>
</div>
<div id='sidebar-right'>
	Download speed:<br />
	<span id="dlspeed">download</span><br />
	Upload speed:<br />
	<span id="ulspeed">upload</span><br />
	Your address:
	<span id="ip">...</span><br />
	<button id="test">begin test</button>
</div>
<?php require_once '_footer.php'; ?>
</body>
</html>